package com.lxc.domain.operation.service;

import com.lxc.domain.operation.model.entity.*;
import com.lxc.domain.operation.repository.IOperationRepository;
import com.lxc.types.common.OperationRequest;
import com.lxc.types.common.OperationResult;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author lxc18
 * @date 2024/12/27 10:47
 * @description OperationServiceImpl
 */
@Service
public class OperationServiceImpl implements IOperationService{
    @Resource
    IOperationRepository operationRepository;
    @Override
    public OperationResult<OPApplicationInterfaceEntity> queryApplicationInterface(OperationRequest<OPApplicationInterfaceEntity> request) {
        List<OPApplicationInterfaceEntity> list = operationRepository.queryApplicationInterfaceListByPage(request);
        int count = operationRepository.queryApplicationInterfaceListCountByPage(request);
        return new OperationResult<>(count,list);
    }

    @Override
    public OperationResult<OPApplicationInterfaceMethodEntity> queryApplicationInterfaceMethod(OperationRequest<OPApplicationInterfaceMethodEntity> request) {
        int count = operationRepository.queryApplicationInterfaceMethodListCountByPage(request);
        List<OPApplicationInterfaceMethodEntity> list = operationRepository.queryApplicationInterfaceMethodListByPage(request);
        return new OperationResult<>(count,list);
    }

    @Override
    public OperationResult<OPGatewayServerEntity> queryGatewayServer(OperationRequest<String> request) {
        List<OPGatewayServerEntity> list = operationRepository.queryGatewayServerListByPage(request);
        int count = operationRepository.queryGatewayServerListCountByPage(request);

        return new OperationResult<>(count,list);
    }

    @Override
    public OperationResult<OPApplicationSystemEntity> queryApplicationSystem(OperationRequest<OPApplicationSystemEntity> request) {
        List<OPApplicationSystemEntity> list = operationRepository.queryApplicationSystemListByPage(request);
        int count = operationRepository.queryApplicationSystemListCountByPage(request);
        return new OperationResult<>(count,list);

    }

    @Override
    public OperationResult<OPGatewayServerDetailEntity> queryGatewayServerDetail(OperationRequest<OPGatewayServerDetailEntity> request) {
        List<OPGatewayServerDetailEntity> list = operationRepository.queryGatewayServerDetailListByPage(request);
        int count = operationRepository.queryGatewayServerDetailListCountByPage(request);
        return new OperationResult<>(count,list);
    }

    @Override
    public OperationResult<OPGatewayDistributionEntity> queryGatewayDistribution(OperationRequest<OPGatewayDistributionEntity> request) {
        int count = operationRepository.queryGatewayDistributionListCountByPage(request);
        List<OPGatewayDistributionEntity> list = operationRepository.queryGatewayDistributionListByPage(request);
        return new OperationResult<>(count,list);

    }


}
